﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DB_NH.DB_Map.ywxt.Project
{
    using NHibernate;
    using NHibernate.Mapping.ByCode;
    using NHibernate.Mapping.ByCode.Conformist;

    using DB_NH.DB_Model.ywxt;

    public class ProjectPlan_Map : ClassMapping<DB_Model.ywxt.Project.ProjectPlan>
    {
        public ProjectPlan_Map()
        {
            //映射ID
            Id(x => x.Id, map => { 
                map.Length(40);
                map.Column("p_id");
            });

            Property(x => x.IsValid, map =>
            {
                map.Column("is_valid");
            });
            Property(x => x.CreateDate, map =>
            {
                map.Column("create_date");
            });

            Property(x => x.p_content, map => map.Length(1000000));
            Property(x => x.p_xmggsj);
            Property(x => x.p_wjfssj1);
            Property(x => x.p_wjfssj2);
            Property(x => x.p_jggssj);
            Property(x => x.p_jgggsj);
            Property(x => x.p_xmkbsj);
            Property(x => x.p_xmzbsj);
            Property(x => x.p_bzjsj);
            Property(x => x.p_remark, map => map.Length(1000000));

            //项目对应的时间安排
            Bag(x => x.RefProjectAndPlans, map =>
            {
                map.Table("r_project_plan");
                map.Key(keyMapper => keyMapper.Column("p_id"));
            }, act => act.OneToMany());

            Table("t_plan_info");

            //不进行创建
            //SchemaAction(NHibernate.Mapping.ByCode.SchemaAction.None);
        }
    }
}
